package com.crowntit.test.types.rule02.factory;

import com.crowntit.test.types.rule02.logic.RuleLogic201;
import com.crowntit.test.types.rule02.logic.RuleLogic202;
import com.crowntit.test.types.rule02.logic.XxxResponse;
import com.crowntit.types.design.framework.link.model2.LinkArmory;
import com.crowntit.types.design.framework.link.model2.chain.BusinessLinkedLink;
import com.crowntit.types.design.framework.link.model2.handler.ILogicHandler;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
@Service
public class Rule02TradeRuleFactory {

    @Bean("rule02Link01")
    public BusinessLinkedLink<String, DynamicContext, XxxResponse> getRule02Link01(RuleLogic201 ruleLogic201, RuleLogic202 ruleLogic202){
        LinkArmory<String, DynamicContext, XxxResponse> linkArmory = new LinkArmory<>("rule02Link01", ruleLogic201, ruleLogic202);
        return linkArmory.getLogicLink();
    }

    @Bean("rule02Link02")
    public BusinessLinkedLink<String, DynamicContext, XxxResponse> getRule02Link02(RuleLogic202 ruleLogic202){
        LinkArmory<String, DynamicContext, XxxResponse> linkArmory = new LinkArmory<>("rule02Link02", ruleLogic202);
        return linkArmory.getLogicLink();
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class DynamicContext{
        private String contextInfo;
    }
}
